<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .xx{
            background-color: red; width: 20%; position: relative;
        }
        .xx:before{
            display: block; content: ''; padding-bottom: 100%;
        }

    </style>
</head>

<body>

<div class='xx'></div>
</body>
</html>